
import java.util.Map;
import java.util.Scanner;


/*
 * Task 4. Calendar Seeker
 */


/**
 * This prints out the day of the week for a given day
 * 
 * @version 0.2 24 Jan 2013
 * @author Tymur Lysak
 */
public class MakeMyDayCalendar {
	public static final String[] DAYSOFWEEK = {"Sunday", "Monday", "Tuesday", "Wednesday",
            "Thursday", "Friday", "Saturday"}; 
	private int day;
	private int month;
	private int year;
	
	public static void main(String[] args) {
		MakeMyDayCalendar dayFinder = new MakeMyDayCalendar();
		dayFinder.inputDateString("Input the string with data in form \"10 October 2010\" ");
		int result = dayFinder.getTheDayOfTheWeek();
		dayFinder.pritnDayOfTheWeekToPromt(result);		
	}
	
	public void inputDateString(String messageToUser) {
		System.out.println(messageToUser);
		String inputString[] = new Scanner(System.in).nextLine().split(" ");	
		day = Integer.parseInt(inputString[0]);
		month = Integer.parseInt(inputString[1]);
		year = Integer.parseInt(inputString[2]);
	}

	public int getTheDayOfTheWeek() {
		int a = (14 - month) / 12;
        int y = (year - a);
        int m = month + 12 * a - 2;
        
		return (7000 + (day + y + y / 4 - y / 100 + y / 400 + (31 * m) / 12)) % 7;
	}
	
	
	private void pritnDayOfTheWeekToPromt(int day) {
		System.out.print("The day of the week is:");
		System.out.println(daysOfWeek[day]);
	}

}
